{% block content %}
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                    aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">删除菜单项</h4>
    </div>
    <div class="modal-body">
        <p id="tip"></p>
        <!-- form start -->
        <div class="box-body">
            确定要删除菜单项 {{ input.title }}？
            <form class="form-horizontal" method="post" id="form-form">
                <input type="text" class="hidden" id="id" value="{{ input.id }}">
            </form>
        </div>
        <!-- /.box-body -->
    </div>
    <div class="modal-footer">
        <button type="button" class="btn btn-info" onclick="return formSubmit()">确定</button>
    </div>
{% endblock %}
{% block extend_scripts %}
    <script>
        function formSubmit() {
            $.ajax(
                {
                    url: "./menu_edit/del/" + $("#id").val(),
                    data: {"id": $("#id").val()},
                    type: "POST",
                    beforeSend: function () {
                        $("#tip").html('<div class="alert alert-info alert-dismissible"><i class="icon fa fa-info"></i>请稍等...</div>');
                        return true;
                    },
                    success: function (data) {
                        if (data) {
                            $('#myModal').modal('hide');
                            alert(data);
                            $("#table").DataTable().ajax.reload(null, false);   //重新加载DataTable数据
                        }
                    }
                });

            return false;
        }
    </script>
{% endblock %}